#!/usr/bin/python2
# -*- coding: utf8 -*-
from PyQt4 import QtCore, QtGui, Qt, QtDeclarative

import sys
from models.MonthJobModel import MonthJobModel
from models.WeekJobModel import WeekJobModel
from models.YearJobModel import YearJobModel
from models.FullDayJobModel import FullDayJobModel
from models.JobsModel import JobsModel
from models.MonthCalendarModel import MonthCalendarModel

from Date import Date
from data.LocalStorage import LocalStorage

app = QtGui.QApplication(sys.argv)
# Создание QML формы
view = QtDeclarative.QDeclarativeView()

localStorage = LocalStorage()
monthJobModel = MonthJobModel(localStorage)
weekJobModel = WeekJobModel(localStorage)
yearJobModel = YearJobModel(localStorage)
fullDayJobModel = FullDayJobModel(localStorage)
jobsModel = JobsModel(localStorage, 0, 9999999999)
date = Date()
monthCalendarModel = MonthCalendarModel()


view.engine().rootContext().setContextProperty("monthCalendarModel", monthCalendarModel)
view.engine().rootContext().setContextProperty("monthJobModel", monthJobModel)
view.engine().rootContext().setContextProperty("weekJobModel", weekJobModel)
view.engine().rootContext().setContextProperty("yearJobModel", yearJobModel)
view.engine().rootContext().setContextProperty("fullDayJobModel", fullDayJobModel)
view.engine().rootContext().setContextProperty("jobsModel", jobsModel)
view.engine().rootContext().setContextProperty("date", date)

#print date.currentTimeInSeconds

view.setSource(QtCore.QUrl('qml/main.qml'))

view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView)
view.show()
sys.exit(app.exec_())
